package com.school.repair.service;

import com.school.repair.dao.BaoXiuDanDao;
import com.school.repair.entity.BaoXiuDan;
import com.school.repair.util.Page;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class BaoXiuDanService {

    @Resource
    BaoXiuDanDao baoXiuDanDao;

    public Page<BaoXiuDan> baoXiuDanLimit(int page, int pageSize, long id) {
            List<BaoXiuDan> list = baoXiuDanDao.baoXiuDanLimit(page, pageSize, id);
            int total = baoXiuDanDao.total(id);
            return new Page<BaoXiuDan>(total, list, page);
    }

    public Page<BaoXiuDan> baoXiuDansOfRepairMan(int page, int pageSize, long id) {
            List<BaoXiuDan> list = baoXiuDanDao.baoXiuDansOfRepairMan(page, pageSize, id);
            int total = baoXiuDanDao.totalByRepairMan(id);
            return new Page<BaoXiuDan>(total, list, page);
    }

    public int add(BaoXiuDan baoxiudan) {
            return baoXiuDanDao.add(baoxiudan);
    }

    public int update(long baoxiudan_id, String repair_res, double fee) {
            return baoXiuDanDao.update(baoxiudan_id, repair_res,fee);
    }

}
